package com.example.mobileeducationstudentv;

import android.os.Bundle;
import android.content.Intent;
import android.app.Activity;
import android.view.Menu;
import android.widget.Button;
import android.view.View;

public class MainActivity extends Activity {

	static Intent studyIntent = null;
	static Intent assIntent = null;
	static Intent helpIntent = null;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		// button that launches the study activity.
		// shows folder structure and files
		// allows files and folders to be navigated. files can be opened if
		// extension is supported
		final Button studyButton = (Button) findViewById(R.id.studyButton);
		studyButton.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				if (studyIntent == null) {
					studyIntent = new Intent(MainActivity.this, Display.class);
				} else {
				}
				startActivity(studyIntent);
			}
		});

		// button that launches the assignment activity.
		// displays list of assignment
		// allows assignment to be completed, graded and results sent via sms
		final Button assignmentButton = (Button) findViewById(R.id.assignmentButton);
		assignmentButton.setOnClickListener(new View.OnClickListener() {

			public void onClick(View v) {
				if (assIntent == null) {
					assIntent = new Intent(MainActivity.this, QuizDisplay.class);
				} else {
				}
				startActivity(assIntent);
			}
		});

		// button that launches the help activity.
		// this allows a student to select a subject to ask for help about and
		// type in a message. it also allows them to send the message.
		final Button helpButton = (Button) findViewById(R.id.helpButton);
		helpButton.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				if (helpIntent == null) {
					helpIntent = new Intent(MainActivity.this, Help.class);
				} else {
				}
				startActivity(helpIntent);
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
